<?php echo $header; ?>
<div id="columnswrapper">
	<?php echo $column_left; ?>
	<div id="content" class="norightsidebar">
		<div class="inner">
		
		
		<div class="listing type-listing hentry">
		
		<p class="hide">&nbsp;</p>
		<h3><?php echo $heading_title; ?></h3>
		<!-- loop through images -->	
			<div id="sliderimage">
				<?php if($stock==2){?>
					<div class="banner-large <?php echo $reduced;?>"></div>
				<?php }else{?>
					<div class="banner-large <?php echo $sold;?>"></div>
				<?php }?>
					<div class="image">
						<img width="540" height="300" alt="<?php echo $heading_title; ?>" title="<?php echo $heading_title; ?>" src="<?php echo $image; ?>" />
						<div class="shadow-large"></div>
					</div>
					
				<?php if ($images) { ?>
					<?php foreach ($images as $image) { ?>
					<div class="image">
						<img width="540" height="300" alt="<?php echo $heading_title; ?>" src="<?php echo $image['other']; ?>" />
						<div class="shadow-large"></div>
					</div>
				<?php } ?>
				<?php } ?>
			</div><!-- end sliderimage -->
			
			
		<!-- Videos section.  Will only show up if there are entries in the Video section of a post  -->
		
		<div class="clear"></div>
		<script type="text/javascript">
		$(function() {
		$('.scrollable').css('width', '590px');
		});
		</script>
		<?php foreach ($downloads as $download) {?>
					<li><?php echo $text_name; ?> <?php echo $download['name']; ?>
					<div style="margin:10px;"	><a style="cursor: pointer;padding:8px 20px;" id="change" onclick="location = '<?php echo str_replace('&', '&amp;', $download['href']); ?>'" class="button"><span><?php echo $text_download; ?></span></a></div></li>	
		<?php }?>
		<p><?php echo $description; ?></p>

		<div id="social">
		 
		<a class="twitter" onclick="share_twitter();" title="Tweet this!">Tweet this page</a>
		
		<a class="stumbleupon" onclick="share_stumbleupon();" title="Share on StumbleUpon">Share on StumbleUpon</a>
		<a class="reddit" onclick="share_reddit();" title="Share on Reddit">Share on Reddit</a>
		<a class="digg" onclick="share_digg();" title="Share on Digg">Share on Digg</a>
		
		<a class="delicious" onclick="share_delicious();"  title="Share on Delicious">Share on Delicious</a>
		
		<a class="facebook" onclick="share_facebook();" title="Share in Facebook">Share in Facebook</a>
		
		</div>
		<div class="clearleft"></div>
			<div class="page-break"></div>
		 <div class="tabs">		      
		      <?php if ($review_status) { ?><a tab="#tab_review"><?php echo $tab_review; ?></a><?php } ?>
		      <a tab="#tab_related"><?php echo $tab_related; ?> (<?php echo count($products); ?>)</a>
    	</div>
    	<?php if ($review_status) { ?>
    	<div id="tab_review" class="tab_page">
        <div id="review"></div>
        <div class="heading" id="review_title"><?php echo $text_write; ?></div>
        <div class="content"><b><?php echo $entry_name; ?></b><br />
        <input type="text" name="name" value="" />
        <br />
        <br />
        <b><?php echo $entry_review; ?></b>
        <textarea name="text" style="width: 98%;" rows="8"></textarea>
        <span style="font-size: 11px;"><?php echo $text_note; ?></span><br />
        <br />
        <b><?php echo $entry_rating; ?></b> <span><?php echo $entry_bad; ?></span>&nbsp;
        <input type="radio" name="rating" value="1" style="margin: 0;" />
        &nbsp;
        <input type="radio" name="rating" value="2" style="margin: 0;" />
        &nbsp;
        <input type="radio" name="rating" value="3" style="margin: 0;" />
        &nbsp;
        <input type="radio" name="rating" value="4" style="margin: 0;" />
        &nbsp;
        <input type="radio" name="rating" value="5" style="margin: 0;" />
        &nbsp; <span><?php echo $entry_good; ?></span><br />
        <br />
        <b><?php echo $entry_captcha; ?></b><br />
        <input type="text" name="captcha" value="" autocomplete="off" />
        <br />
        <img src="index.php?route=product/product/captcha" id="captcha" /></div>
      
       <div ><a style="cursor: pointer;padding:8px 20px;" id="change" onclick="review();" class="button"><?php echo $button_continue; ?></a></div>
          
      
    </div>
    <?php } ?>
		<div id="tab_related" class="tab_page">
      <?php if ($products) { ?>
      <table class="list">
        <?php for ($i = 0; $i < sizeof($products); $i = $i + 4) { ?>
        <tr>
          <?php for ($j = $i; $j < ($i + 4); $j++) { ?>
          <td width="25%"><?php if (isset($products[$j])) { ?>
            <a href="<?php echo str_replace('&', '&amp;', $products[$j]['href']); ?>"><img src="<?php echo $products[$j]['thumb']; ?>" title="<?php echo $products[$j]['name']; ?>" alt="<?php echo $products[$j]['name']; ?>" /></a><br />
            <a href="<?php echo str_replace('&', '&amp;', $products[$j]['href']); ?>"><?php echo $products[$j]['name']; ?></a><br />       
            <?php } ?></td>
          <?php } ?>
        </tr>
        <?php } ?>
      </table>
      <?php } else { ?>
      <div style="background: #F7F7F7; border: 1px solid #DDDDDD; padding: 10px; margin-bottom: 10px;"><?php echo $text_no_related; ?></div>
      <?php } ?>
    	</div>
	</div><!-- end post -->
	</div><!-- end inner -->
	</div><!-- end content -->
	<script type="text/javascript">
			
		function share_facebook()
		{
			var	u=location.href;
			var t=document.title;
			window.open("http://www.facebook.com/share.php?u="+encodeURIComponent(u)+"&t="+encodeURIComponent(t));
		
		}
		
		function share_twitter()
		{
			var	uvnn=location.href;
			var tvnn=document.title;
			window.open("http://twitter.com/home?status=" + encodeURIComponent(uvnn));
		}
		
		function share_stumbleupon()
		{
			var	uvnn=location.href;
			var tvnn=document.title;
			window.open("http://www.stumbleupon.com/submit?url=" + encodeURIComponent(uvnn));
		}
		
		function share_reddit()
		{
			var	uvnn=location.href;
			var tvnn=document.title;
			window.open("http://www.reddit.com/submit?url=" + encodeURIComponent(uvnn));
		}
		
		function share_digg()
		{
			var	uvnn=location.href;
			var tvnn=document.title;
			window.open("http://digg.com/submit?phase=2&amp;amp;url=" + encodeURIComponent(uvnn));
		}
		function share_delicious()
		{
			var	uvnn=location.href;
			var tvnn=document.title;
			window.open("http://del.icio.us/post?url=" + encodeURIComponent(uvnn));
		}
	</script>
	<script type="text/javascript"><!--
		$('#review .pagination a').live('click', function() {
			$('#review').slideUp('slow');
				
			$('#review').load(this.href);
			
			$('#review').slideDown('slow');
			
			return false;
		});			
		
		$('#review').load('index.php?route=product/product/review&product_id=<?php echo $product_id; ?>');
		
		function review() {
			$.ajax({
				type: 'POST',
				url: 'index.php?route=product/product/write&product_id=<?php echo $product_id; ?>',
				dataType: 'json',
				data: 'name=' + encodeURIComponent($('input[name=\'name\']').val()) + '&text=' + encodeURIComponent($('textarea[name=\'text\']').val()) + '&rating=' + encodeURIComponent($('input[name=\'rating\']:checked').val() ? $('input[name=\'rating\']:checked').val() : '') + '&captcha=' + encodeURIComponent($('input[name=\'captcha\']').val()),
				beforeSend: function() {
					$('.success, .warning').remove();
					$('#review_button').attr('disabled', 'disabled');
					$('#review_title').after('<div class="wait"><img src="catalog/view/theme/default/image/loading_1.gif" alt="" /> <?php echo $text_wait; ?></div>');
				},
				complete: function() {
					$('#review_button').attr('disabled', '');
					$('.wait').remove();
				},
				success: function(data) {
					if (data.error) {
						$('#review_title').after('<div class="warning">' + data.error + '</div>');
					}
					
					if (data.success) {
						$('#review_title').after('<div class="success">' + data.success + '</div>');
										
						$('input[name=\'name\']').val('');
						$('textarea[name=\'text\']').val('');
						$('input[name=\'rating\']:checked').attr('checked', '');
						$('input[name=\'captcha\']').val('');
					}
				}
			});
		}
	//--></script>
	<script type="text/javascript"><!--
	$.tabs('.tabs a'); 
//--></script>
	<?php echo $column_right; ?>	
	</div><!-- end columnswrapper -->
<?php echo $footer; ?> 